/**
 * 
 */
define(function(require, exports, module){
    'use strict';
   
    function canvas(cvs_){
        var cvs =cvs_;
        this.fillRect=function(x,y,h,w){
        	cvs.fillRect(x,y,h,w);
        	return this;
        };
        this.lineWidth=function(w){
        	cvs.lineWidth=w;
        	return this;
        };
        this.fillStyle= function(style){
        	cvs.fillStyle = style;
        	return this;
        };
        this.clearRect = function(x,y,h,w){
        	cvs.clearRect(x,y,h,w);
        	return this;
        };
        this.stroke = function(){
        	cvs.stroke();
        	return this;
        }; 
        this.beginPath = function(){
        	cvs.beginPath();
        	return this;
        };
        this.strokeStyle = function(color){
        	cvs.strokeStyle=color;
        	return this;
        };
        this.moveTo = function(x,y){
        	cvs.moveTo(x,y);
        	return this;
        };
        this.lineTo = function(x1,y1){
        	cvs.lineTo(x1,y1);
        	return this;
        };
        this.fillText = function(text,x,y){
        	cvs.fillText(text,x,y);
        	return this;
        };
        this.font = function(text){
        	cvs.font = text;
        	return this;
        };
        this.arc = function(x,y){
        	cvs.arc(x,y,6,0,2*Math.PI,true);
        	return this;
        };
        this.closePath = function(){
        	cvs.closePath();
        	return this;
        };
        this.fill = function(){
        	cvs.fill();
        	return this;
        };
        this.polygon=function(poly){
        	cvs.beginPath();
        	cvs.moveTo(poly[0], poly[1]);
            for (var i = 2; i < poly.length; i += 2) {
            	cvs.lineTo(poly[i], poly[i + 1]);
            }
            cvs.closePath();
            cvs.fill();
            cvs.stroke();
        	return this;
        }
    }
    module.exports = {
            init: function (cvs_) {
                return new canvas(cvs_);
            }
        }
});